-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto: Remove inner mutable shared state from Account
#2710
Conversation
caacc24
to
04396eb
Compare
3c6fdb9
to
4df2d96
Compare
…uery The store cache can be filled lazily when it's actually needed. It's not needed in this function here, and may be needed in another function the caller of this function may call later. No need to preemptively fill the cache here.
4df2d96
to
7eb71f9
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2710 +/- ##
==========================================
- Coverage 78.71% 78.68% -0.03%
==========================================
Files 200 200
Lines 20359 20392 +33
==========================================
+ Hits 16025 16046 +21
- Misses 4334 4346 +12
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the first five commits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Suggested some small changes in a review party:
- Using a result in tests usually produces worse error reports if a test fails
- Let's not use
clone_internal()
in non-test code - Something for the future, try out if the
OwnedRwLockGuard
is necessary, maybe we can use the non-owned variant.
Thanks for methodically going through the mess and making sense of it, very nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks fine.
The
Account
is lazily loaded in the cache, and transferred from the cache toPendingChanges
in case ofStoreTransaction
. Later,Account
is made not cloneable anymore, and inner mutable shared state is removed from there, so we can identify which interactions with the cache must be transactions (i.e. which Account function calls require write access), and which can just be reads from the cache (i.e. which Account function calls requires read-only access). Eventually, the cache is put behind a RwLock, so we can't read and write to the cache at the same time; this lock is taken in write access during transactions, and in read-only access during cache reads.This can be reviewed commit by commit.
Multiple parts of #2624.